package com.ruoyi.user.controller;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.user.domain.CarType;
import com.ruoyi.user.service.CarTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/carType")
@CrossOrigin
public class CarTypeController extends BaseController {
    
    @Autowired
    private CarTypeService carTypeService;
    
    /**
     * 查询车型列表
     */
    @GetMapping("/list")
    public TableDataInfo list(CarType carType) {
        startPage();
        List<CarType> list = carTypeService.selectCarTypeList(carType);
        return getDataTable(list);
    }
    
    /**
     * 获取所有车型列表（不分页）
     */
    @GetMapping("/listAll")
    public AjaxResult listAll(CarType carType) {
        List<CarType> list = carTypeService.selectCarTypeList(carType);
        return AjaxResult.success(list);
    }
}